<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script >
    let value1 = "1" ;
    //构造一个 js 对象
    let body = {
        key1: 1 ,
        key2: 2
    }
    $.ajax({
        type: "post" ,
        // contentType是什么格式
        contentType: "application/json",
       // 这里就是 data 里面就是post请求 的 body部分
        data: JSON.stringify(body), //这个方法用来把 js对象转换成json格式的字符串
        url: "https://www.baidu.com/ajax.html?"+"key="+value1,
        success: function (body){
          console.log(body);
        }
    });
</script>

</body>
</html>